/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.engin.setting;

import ac.ui.FrameOperationTemplat;

/**
 *
 * @author empcl_000
 */
public class dbsetting extends FrameOperationTemplat {

    public int tabelClears(String[] tabels) {

        //products_reportes
        for (String t : tabels) {
            db.setDelete(t, "1=1");
        }
        return db.retuenstatus;

    }

    public int tabelClears(String[] tabels, String Fields, String disable) {

        //products_reportes
        for (String t : tabels) {
            db.setDelete(t, Fields + " NOT LIKE '%" + disable + "%'");
        }
        return db.retuenstatus;

    }
    ac.uitls.propertiesOperation op = new ac.uitls.propertiesOperation();

    public String updateSetting(String[] data) {
        String returnData = "";
        returnData += op.setProperty("DBname", data[1]);
        returnData += op.setProperty("DBPassword", data[3]);
        returnData += op.setProperty("DBHost", data[0]);
        returnData += op.setProperty("DBUser", data[2]);

        if (returnData.trim().equals("")) {
            returnData = op.getWord("label.updateMessage");
        }
        return returnData;
    }

    public String defSetting() {
        String returnData = "";
        returnData += op.setProperty("DBname", "ac");
        returnData += op.setProperty("DBPassword", "3mrmosho");
        returnData += op.setProperty("DBHost", "localhost");
        returnData += op.setProperty("DBUser", "root");
        if (returnData.trim().equals("")) {
            returnData = op.getWord("label.defaultMessage");
        }

        return returnData;
    }

    public String[] getSetting() {
        String[] returnData = {op.getProperty("DBHost"), op.getProperty("DBname"), op.getProperty("DBUser"), op.getProperty("DBPassword")};

        return returnData;
    }
}
